import request from '/@/utils/request'
import { IMenuData } from '/@/entity/menuBean'

export const defaultMenuData: IMenuData = {
	pId: 0, //默认顶级
	name: '', //菜单名称
	icon: '', //菜单图标
	url: '', //菜单地址
	mOrder: 1, //菜单顺序
	state: 1, //菜单状态，1：可用，2：不可用
	type: 1 //该url地址是菜单还是权限，1：菜单，2：权限
}

//获取全部菜单列表
export const getMenu = (params: any): any =>
	request({
		url: '/auth/getMenu',
		method: 'GET',
		params: params
	})

//新增菜单
export const addSysPermission = (params: any): any =>
	request({
		url: '/auth/addSysPermission',
		method: 'POST',
		params: params
	})

//编辑菜单
export const updateSysPermission = (params: any): any =>
	request({
		url: '/auth/updateSysPermission',
		method: 'POST',
		params: params
	})

//删除菜单
export const delSysPermission = (params: any): any =>
	request({
		url: '/auth/delSysPermission',
		method: 'POST',
		params: params
	})
